// comm/views/hdModalView/hdModalView.js
import S_request from '../../../utils/requestService.js';
import CONFIG from '../../../config.js';
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    modalObj: {
      type: Object,
      value: null
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    modalObj: {},
    quanList: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
  },
  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    created: function() {},
    attached: function() {},
    moved: function() {},
    detached: function() {},
  },
  ready: function () { 
    let modalObj = this.data.modalObj;
    if (modalObj.isZj) {//中奖
      modalObj.icon = '../image/zj_icon.png',
      modalObj.title = '恭喜，您已中奖'
      modalObj.titleStyle = 'color:#d1594e'
      if (modalObj.jindu == 0) {
        modalObj.isShowAddr = true
      } else {
        modalObj.isShowAddr = false
      }
    } else {//未中奖
      modalObj.icon = '../image/zj_icon.png'
      modalObj.title = '差一点点就中奖了，继续努力！'
      modalObj.titleStyle = 'color:#333'
      modalObj.isShowAddr = false
    }
    if (modalObj.winList.length == 1) {
      modalObj.bodyStyle = 'left:calc((100% - 154rpx)/2);width:154rpx;'
    } else if (modalObj.winList.length == 2) {
      modalObj.bodyStyle = 'left:calc((100% - 308rpx)/2);width:308rpx;'
    } else {
      modalObj.bodyStyle = 'left:calc((100% - 462rpx)/2);width:462rpx;'
    }
    this.setData({
      modalObj: modalObj
    })
    console.log("aaaa===" + JSON.stringify(this.data.modalObj))
  },

  /**
   * 组件的方法列表
   */
  methods: {
    returnEevet: function(e) {},
    closeBtnAc: function(e) {
      this.triggerEvent('closeZjBtnAc', e)
    },
    openAddress:function(e) {
      console.log("aaaaa")
      this.triggerEvent('getReward', e)
      setTimeout(function () {
        this.triggerEvent('closeZjBtnAc', e)
      }.bind(this), 2000)
    }
  }
})